package com.xxx.plugin;

import com.xxx.plugin.util.FiltUtil;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

/**
 * Description
 * ...
 * DATE 2017/12/9.
 *
 * @author Mr. Chun.
 */
@Mojo(name = "config")
public class Config extends AbstractMojo {

    @Parameter
    private String token;

    public void execute() throws MojoExecutionException, MojoFailureException {
        if (token.equals("xxx")) {
            System.out.println("Config execute(), token is right");
            try {
                FiltUtil.touchApplication();
                System.out.println("文件创建成功!");
            } catch (Exception e) {
                System.out.println("文件创建失败， e:" + e.getMessage());
            }
        } else {
            System.out.println("Config execute(), token is wrong!");
        }
    }
}
